/**
* Copyright (c) 2016-2100 yunclouds
*/
package com.yunqian.redot.repository;

import com.yunqian.redot.domain.InformationType;
import com.yunqian.repository.BaseRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 咨询分类管理
 *
 * @author zsy
 * 2018-09-29 15:54:40
 */
@Repository
public interface InformationTypeRepository extends BaseRepository<InformationType, Long> {

    /**
     * 咨讯分类列表排序
     * @return
     */
    List<InformationType> findAllByOrderBySortNum();

    /**
     * 显示分类
     * @param status
     * @return
     */
    List<InformationType> findAllByStatusOrderBySortNum(Integer status);

    /**
     * 根据名称查找
     * @param title
     * @return
     */
    boolean existsByTitle(String title);

    /**
     * 根据名称查找并排除id
     * @param title
     * @param id
     * @return
     */
    boolean existsByTitleAndIdNot(String title, Long id);

    InformationType findFirstById(Long id);
}
